import axios from 'axios'
import useUserStore from '@/store/module/user'
const request = axios.create({

    baseURL: '/api',
    timeout: 5000

})
request.interceptors.request.use(config => {

    const userStore = useUserStore()
    if (userStore.token) {
        config.headers.token = userStore.token
    }
    return config
})
request.interceptors.response.use(response => {

    return response.data

})

export default request